const jwt = require('jsonwebtoken');
let secret = 'xiaohe'
// 生产token
const generateToken = (id) => {

    let payload = { id, time: new Date() }

    let token = jwt.sign(payload, secret, { expiresIn: 60 * 60 * 24 * 120 })

    return token

}

// 解码
const verifyToken = (e) => {

    let payload = jew.filters(e, secret)
    return payload
}
module.exports = { generateToken, verifyToken }